//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.web.controller.workflow;

import com.aidong.dao.base.ConditionMap;
import com.aidong.dao.base.OrderSet;
import com.aidong.dao.base.Pagination;
import com.aidong.dao.wills.CardTypeCodeDao;
import com.aidong.dao.wills.DicSalesCodeDao;
import com.aidong.dao.wills.GiftCardDao;
import com.aidong.dao.wills.PayListDao;
import com.aidong.dao.wills.PayTypeCodeDao;
import com.aidong.dao.wills.PtBespeakDao;
import com.aidong.dao.wills.PtCoachCodeDao;
import com.aidong.dao.wills.WorkflowTypeDao;
import com.aidong.model.wills.CardTypeCode;
import com.aidong.model.wills.DicSalesCode;
import com.aidong.model.wills.GiftCard;
import com.aidong.model.wills.MemberContract;
import com.aidong.model.wills.MemberEarnest;
import com.aidong.model.wills.MemberInfo;
import com.aidong.model.wills.PayList;
import com.aidong.model.wills.PssProductSale;
import com.aidong.model.wills.PtBespeak;
import com.aidong.model.wills.PtContract;
import com.aidong.model.wills.Upload;
import com.aidong.model.wills.WorkflowDetail01;
import com.aidong.model.wills.WorkflowDetail02;
import com.aidong.model.wills.WorkflowDetail03;
import com.aidong.model.wills.WorkflowDetail05;
import com.aidong.model.wills.WorkflowDetail06;
import com.aidong.model.wills.WorkflowDetail07;
import com.aidong.model.wills.WorkflowDetail08;
import com.aidong.model.wills.WorkflowDetail09;
import com.aidong.model.wills.WorkflowDetail10;
import com.aidong.model.wills.WorkflowDetail11;
import com.aidong.model.wills.WorkflowDetail12;
import com.aidong.model.wills.WorkflowDetail13;
import com.aidong.model.wills.WorkflowDetail14;
import com.aidong.model.wills.WorkflowDetail15;
import com.aidong.model.wills.WorkflowDetail16;
import com.aidong.model.wills.WorkflowDetail17;
import com.aidong.model.wills.WorkflowDetail18;
import com.aidong.model.wills.WorkflowDetail19;
import com.aidong.model.wills.WorkflowDetail20;
import com.aidong.model.wills.WorkflowDetail21;
import com.aidong.model.wills.WorkflowDetail22;
import com.aidong.model.wills.WorkflowDetail23;
import com.aidong.model.wills.WorkflowDetail24;
import com.aidong.model.wills.WorkflowDetail28;
import com.aidong.model.wills.WorkflowDetail30;
import com.aidong.model.wills.WorkflowDetail31;
import com.aidong.model.wills.WorkflowDetail32;
import com.aidong.model.wills.WorkflowDetail33;
import com.aidong.model.wills.WorkflowDetail34;
import com.aidong.model.wills.WorkflowFile;
import com.aidong.model.wills.WorkflowList;
import com.aidong.model.wills.WorkflowType;
import com.aidong.service.UploadService;
import com.aidong.util.ExportXls;
import com.aidong.util.FuncUtil;
import com.aidong.web.controller.workflow.WorkflowController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping({"workflowApply"})
public class WorkflowApplyController extends WorkflowController {
    @Resource
    WorkflowTypeDao workflowTypeDao;
    @Resource
    UploadService uploadService;
    @Resource
    PayListDao payListDao;
    @Resource
    CardTypeCodeDao cardTypeCodeDao;
    @Resource
    PtCoachCodeDao ptCoachCodeDao;
    @Resource
    DicSalesCodeDao dicSalesCodeDao;
    @Resource
    PayTypeCodeDao payTypeCodeDao;
    @Resource
    PtBespeakDao ptBespeakDao;
    @Resource
    protected GiftCardDao giftCardDao;

    public WorkflowApplyController() {
    }

    @RequestMapping({"list"})
    public ModelAndView list() {
        return (new ModelAndView("workflow/apply/list")).addObject("workflowType", this.getTypeList("workflowType")).addObject("workflowStatus", this.getTypeList("workflowStatus"));
    }

    @RequestMapping({"_list"})
    public ModelAndView _list(@RequestParam(value = "shopCode",required = false) String shopCode, @RequestParam(value = "typeId",required = false) String typeId, @RequestParam(value = "status",required = false) Integer status, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "workflowId",required = false) String workflowId, @RequestParam(value = "dateType",required = false) String dateType, @RequestParam(value = "dateFrom",required = false) String dateFrom, @RequestParam(value = "dateTo",required = false) String dateTo, @RequestParam(value = "pageNo",required = false) String pageNo, @RequestParam(value = "totalCount",required = false) String totalCount) {
        Pagination pg = new Pagination(1, 20);
        pg.setPage(this.parseInt(pageNo), this.parseInt(totalCount));
        ConditionMap cd = new ConditionMap();
        this.addConditionShopCode(cd, "shopCode", shopCode);
        cd.eq("typeId", typeId);
        cd.eq("status", status);
        cd.eq("workflowId", this.parseInt(workflowId));
        ConditionMap cd1;
        if(!this.chkNull(name)) {
            cd1 = new ConditionMap(1);
            cd1.like("contractCode", "%" + name + "%");
            cd1.like("memberCode", "%" + name + "%");
            cd1.like("memberName", "%" + name + "%");
            cd.addSub(cd1);
        }

        cd1 = new ConditionMap(1);
        cd1.ne("status", Integer.valueOf(9));
        cd1.eq("createUser", this.getLoginUserCode());
        cd.addSub(cd1);
        if("2".equals(dateType)) {
            if(!this.chkNull(dateFrom)) {
                cd.ge("procTime1", this.getDateFrom(dateFrom));
            }

            if(!this.chkNull(dateTo)) {
                cd.le("procTime1", this.getDateTo(dateTo));
            }
        } else if("3".equals(dateType)) {
            if(!this.chkNull(dateFrom)) {
                cd.ge("procTime3", this.getDateFrom(dateFrom));
            }

            if(!this.chkNull(dateTo)) {
                cd.le("procTime3", this.getDateTo(dateTo));
            }
        } else {
            if(!this.chkNull(dateFrom)) {
                cd.ge("submitTime", this.getDateFrom(dateFrom));
            }

            if(!this.chkNull(dateTo)) {
                cd.le("submitTime", this.getDateTo(dateTo));
            }
        }

        if(this.queryOwn()) {
            cd.eq("createUser", this.getLoginUserCode());
        }

        this.workflowListDao.queryPageList(pg, cd, (new OrderSet()).desc("workflowId"));
        ModelAndView mv = new ModelAndView("workflow/apply/_list");
        mv.addObject("list", pg.getResultList());
        mv.addObject("pg", pg);
        return mv;
    }

    @RequestMapping({"expt"})
    public ModelAndView expt(@RequestParam(value = "shopCode",required = false) String shopCode, @RequestParam(value = "typeId",required = false) String typeId, @RequestParam(value = "status",required = false) Integer status, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "workflowId",required = false) String workflowId, @RequestParam(value = "dateType",required = false) String dateType, @RequestParam(value = "dateFrom",required = false) String dateFrom, @RequestParam(value = "dateTo",required = false) String dateTo, HttpServletResponse response) {
        try {
            Pagination e = new Pagination(1, '\uea60');
            e.setPage(Integer.valueOf(1), Integer.valueOf(1));
            ConditionMap cd = new ConditionMap();
            this.addConditionShopCode(cd, "shopCode", shopCode);
            cd.eq("typeId", typeId);
            cd.eq("status", status);
            cd.eq("workflowId", this.parseInt(workflowId));
            ConditionMap cd1;
            if(!this.chkNull(name)) {
                cd1 = new ConditionMap(1);
                cd1.like("contractCode", "%" + name + "%");
                cd1.like("memberCode", "%" + name + "%");
                cd1.like("memberName", "%" + name + "%");
                cd.addSub(cd1);
            }

            cd1 = new ConditionMap(1);
            cd1.ne("status", Integer.valueOf(9));
            cd1.eq("createUser", this.getLoginUserCode());
            cd.addSub(cd1);
            if("2".equals(dateType)) {
                if(!this.chkNull(dateFrom)) {
                    cd.ge("procTime1", this.getDateFrom(dateFrom));
                }

                if(!this.chkNull(dateTo)) {
                    cd.le("procTime1", this.getDateTo(dateTo));
                }
            } else if("3".equals(dateType)) {
                if(!this.chkNull(dateFrom)) {
                    cd.ge("procTime3", this.getDateFrom(dateFrom));
                }

                if(!this.chkNull(dateTo)) {
                    cd.le("procTime3", this.getDateTo(dateTo));
                }
            } else {
                if(!this.chkNull(dateFrom)) {
                    cd.ge("submitTime", this.getDateFrom(dateFrom));
                }

                if(!this.chkNull(dateTo)) {
                    cd.le("submitTime", this.getDateTo(dateTo));
                }
            }

            if(this.queryOwn()) {
                cd.eq("createUser", this.getLoginUserCode());
            }

            this.workflowListDao.queryPageList(e, cd, (new OrderSet()).desc("workflowId"));
            ExportXls xls = new ExportXls(response, "审批记录", "审批记录");
            xls.addHead(new String[]{"门店编号", "门店名称", "申请编号", "申请时间", "类型", "合同号", "会员编号", "会员姓名", "流程状态", "申请人", "提交附件", "提交时间", "申请原因", "初审时间", "初审人", "初审结果", "初审意见", "复审时间", "复审人", "复审结果", "复审意见", "终审时间", "终审人", "终审结果", "终审意见"});
            xls.setWidth(new int[]{10, 15, 10, 20, 20, 15, 20, 10, 10, 15, 10, 20, 20, 20, 15, 10, 20, 20, 15, 10, 20, 20, 15, 10, 20});
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Iterator i$ = e.getResultList().iterator();

            while(i$.hasNext()) {
                WorkflowList workflow = (WorkflowList)i$.next();
                xls.addRow(new Object[]{workflow.getShopCode(), this.cache.getValue("shopName", workflow.getShopCode()), workflow.getWorkflowId(), sdf.format(workflow.getCreateTime()), this.cache.getValue("workflowType", workflow.getTypeId()), workflow.getContractCode(), workflow.getMemberCode(), workflow.getMemberName(), this.cache.getValue("workflowStatus", String.valueOf(workflow.getStatus())), this.nvl(workflow.getCreateUser()) + " - " + this.nvl(this.cache.getValue("userName", workflow.getCreateUser())), workflow.getFileNum().intValue() > 0?"已上传":"未上传", workflow.getSubmitTime() == null?null:sdf.format(workflow.getSubmitTime()), workflow.getNote(), workflow.getProcTime1() == null?null:sdf.format(workflow.getProcTime1()), workflow.getProcUser1() == null?null:this.nvl(workflow.getProcUser1()) + " - " + this.nvl(this.cache.getValue("userName", workflow.getProcUser1())), this.cache.getValue("workflowResult", String.valueOf(workflow.getProcResult1())), workflow.getProcNote1(), workflow.getProcTime2() == null?null:sdf.format(workflow.getProcTime2()), workflow.getProcUser2() == null?null:this.nvl(workflow.getProcUser2()) + " - " + this.nvl(this.cache.getValue("userName", workflow.getProcUser2())), this.cache.getValue("workflowResult", String.valueOf(workflow.getProcResult2())), workflow.getProcNote2(), workflow.getProcTime3() == null?null:sdf.format(workflow.getProcTime3()), workflow.getProcUser3() == null?null:this.nvl(workflow.getProcUser3()) + " - " + this.nvl(this.cache.getValue("userName", workflow.getProcUser3())), this.cache.getValue("workflowResult", String.valueOf(workflow.getProcResult3())), workflow.getProcNote3()});
            }

            xls.close();
            this.addUserLog("导出审批记录", e.getResultList().size() + "条记录");
        } catch (Exception var17) {
            this.log.error("import", var17);
        }

        return null;
    }

    @RequestMapping({"add"})
    public ModelAndView add(@RequestParam(value = "typeId",required = false) String typeId) {
        ModelAndView mv;
        if(this.chkNull(typeId)) {
            List workflowType1 = this.workflowTypeDao.getValidTypeList();
            mv = new ModelAndView("workflow/apply/add");
            mv.addObject("list", workflowType1);
            mv.addObject("category", this.getTypeList("workflowCategory"));
            return mv;
        } else {
            WorkflowType workflowType = (WorkflowType)this.workflowTypeDao.getById(typeId);
            if(workflowType == null) {
                return this.showAlert("申请类型错误!");
            } else if(workflowType.getStatus().intValue() != 1) {
                return this.showAlert("目前不能提交该类申请!");
            } else {
                mv = new ModelAndView("workflow/apply/add" + workflowType.getCode());
                mv.addObject("workflowType", workflowType);
                mv.addObject("_picPath", this.getSetting("pic.path"));
                mv.addObject("_oper", "add");
                if(!"01".equals(typeId) && !"33".equals(typeId)) {
                    if("11".equals(typeId)) {
                        mv.addObject("cardArea", this.getTypeList("cardArea"));
                    } else if("13".equals(typeId)) {
                        mv.addObject("shopName", this.getTypeList("shopName"));
                    } else if("15".equals(typeId)) {
                        mv.addObject("coachList", this.ptCoachCodeDao.getShopCoachList(this.getLoginShopCode()));
                    } else if(FuncUtil.strInArray(typeId, new String[]{"16", "17", "25", "26", "27", "28", "29", "32"})) {
                        mv.addObject("payType", this.getTypeList("payType"));
                    }
                } else {
                    mv.addObject("gender", this.getTypeList("gender"));
                    mv.addObject("idType", this.getTypeList("idType"));
                }

                return mv;
            }
        }
    }

    @RequestMapping({"_add"})
    @ResponseBody
    public String _add(@ModelAttribute("workflow") WorkflowList workflow, HttpServletRequest request) {
        if(this.chkNull(workflow.getTypeId())) {
            return this.getResult(false, "申请类型错误");
        } else {
            WorkflowType workflowType = (WorkflowType)this.workflowTypeDao.getById(workflow.getTypeId());
            if(workflowType == null) {
                return this.getResult(false, "申请类型错误!");
            } else if(workflowType.getStatus().intValue() != 1) {
                return this.getResult(false, "目前不能提交该类申请!");
            } else {
                Object workflowDetail = null;
                Object extProp = null;
                if("01".equals(workflow.getTypeId())) {
                    if(this.chkNull(workflow.getMemberCode())) {
                        return this.getResult(false, "会员编号错误!");
                    }

                    MemberInfo ccode5 = this.memberInfoDao.getById(workflow.getMemberCode());
                    if(ccode5 == null) {
                        return this.getResult(false, "会员编号错误!");
                    }

                    WorkflowDetail01 e27 = new WorkflowDetail01();
                    workflowDetail = e27;
                    e27.setMemberCode(workflow.getMemberCode());
                    e27.setOldChName(ccode5.getChName());
                    e27.setOldEnName(ccode5.getEnName());
                    e27.setOldGender(ccode5.getGender());
                    e27.setOldIdType(ccode5.getIdType());
                    e27.setOldIdNumber(ccode5.getIdNumber());
                    e27.setOldMobile(ccode5.getMobile());
                    e27.setOldPhone(ccode5.getPhone());
                    e27.setOldBirthday(ccode5.getBirthday());
                    e27.setOldCountry(ccode5.getCountry());
                    e27.setOldEmail(ccode5.getEmail());
                    e27.setOldAddress(ccode5.getAddress());
                    e27.setOldNote(ccode5.getNote());
                    e27.setOldMemberPhoto(ccode5.getMemberPhoto());
                    e27.setOldIdCardPhoto(ccode5.getIdCardPhoto());
                    e27.setChName(this.getParam(request, "chName"));
                    e27.setEnName(this.getParam(request, "enName"));
                    e27.setGender(this.getParam(request, "gender"));
                    e27.setIdType(this.getParam(request, "idType"));
                    e27.setIdNumber(this.getParam(request, "idNumber"));
                    e27.setMobile(this.getParam(request, "mobile"));
                    e27.setPhone(this.getParam(request, "phone"));
                    e27.setBirthday(this.getParamDate(request, "birthday"));
                    e27.setCountry(this.getParam(request, "country"));
                    e27.setEmail(this.getParam(request, "email"));
                    e27.setAddress(this.getParam(request, "address"));
                    e27.setNote(this.getParam(request, "memberNote"));
                    e27.setMemberPhoto(this.getParam(request, "memberPhoto"));
                    e27.setIdCardPhoto(this.getParam(request, "idCardPhoto"));
                    workflow.setMemberName(e27.getOldChName());
                } else {
                    Integer detail;
                    PayList payListId;
                    if(FuncUtil.strInArray(workflow.getTypeId(), new String[]{"08", "09", "10", "11", "12", "13", "14", "17", "20", "23", "24", "30", "31", "34"})) {
                        label374: {
                            if(this.chkNull(workflow.getContractCode())) {
                                return this.getResult(false, "请输入合同号");
                            }

                            MemberContract ccode4 = this.memberContractDao.getByContractCode(workflow.getContractCode());
                            if(ccode4 == null) {
                                return this.getResult(false, "合同号错误!");
                            }

                            if(ccode4.getBeginTime() != null && ccode4.getEndTime() != null && ccode4.getEffectiveDate() == null) {
                                workflow.setMemberCode(ccode4.getMemberCode());
                                if("08".equals(workflow.getTypeId())) {
                                    WorkflowDetail08 e26 = new WorkflowDetail08();
                                    workflowDetail = e26;
                                    e26.setContractCode(workflow.getContractCode());
                                    e26.setOldQuantity(ccode4.getTotalCount());
                                    e26.setQuantity(this.getParamInt(request, "quantity"));
                                    if(this.chkNullZ(e26.getQuantity())) {
                                        return this.getResult(false, "更改次数数错误!");
                                    }
                                    break label374;
                                }

                                if("09".equals(workflow.getTypeId())) {
                                    WorkflowDetail09 e25 = new WorkflowDetail09();
                                    workflowDetail = e25;
                                    e25.setContractCode(workflow.getContractCode());
                                    e25.setOldBeginDate(ccode4.getBeginTime());
                                    e25.setOldEndDate(ccode4.getEndTime());
                                    e25.setBeginDate(this.getParamDate(request, "beginDate"));
                                    e25.setEndDate(this.getParamDate(request, "endDate"));
                                    if(!this.chkNull(e25.getBeginDate()) && !this.chkNull(e25.getEndDate())) {
                                        break label374;
                                    }

                                    return this.getResult(false, "更改日期错误!");
                                }

                                if("10".equals(workflow.getTypeId())) {
                                    WorkflowDetail10 e24 = new WorkflowDetail10();
                                    workflowDetail = e24;
                                    e24.setContractCode(workflow.getContractCode());
                                    e24.setOldCardType(ccode4.getCardType());
                                    e24.setCardType(this.getParam(request, "cardType"));
                                    if(this.chkNull(e24.getCardType())) {
                                        return this.getResult(false, "新会籍类型错误!");
                                    }
                                    break label374;
                                }

                                if("11".equals(workflow.getTypeId())) {
                                    WorkflowDetail11 e23 = new WorkflowDetail11();
                                    workflowDetail = e23;
                                    e23.setContractCode(workflow.getContractCode());
                                    e23.setOldManyShop(ccode4.getManyShop());
                                    e23.setManyShop(this.getParam(request, "manyShop"));
                                    if(this.chkNull(e23.getManyShop())) {
                                        return this.getResult(false, "新通店区域错误!");
                                    }
                                    break label374;
                                }

                                if("12".equals(workflow.getTypeId())) {
                                    WorkflowDetail12 e22 = new WorkflowDetail12();
                                    workflowDetail = e22;
                                    e22.setContractCode(workflow.getContractCode());
                                    e22.setOldNewEndTime(ccode4.getNewEndTime());
                                    e22.setNewEndTime(this.getParamDate(request, "newEndTime"));
                                    if(this.chkNull(e22.getNewEndTime())) {
                                        return this.getResult(false, "新加增日期错误!");
                                    }
                                    break label374;
                                }

                                if("13".equals(workflow.getTypeId())) {
                                    WorkflowDetail13 e21 = new WorkflowDetail13();
                                    workflowDetail = e21;
                                    e21.setContractCode(workflow.getContractCode());
                                    e21.setAddShopCode(this.getParam(request, "shopCode"));
                                    if(this.chkNull(e21.getAddShopCode())) {
                                        return this.getResult(false, "新加通店错误!");
                                    }
                                    break label374;
                                }

                                if("14".equals(workflow.getTypeId())) {
                                    WorkflowDetail14 e20 = new WorkflowDetail14();
                                    workflowDetail = e20;
                                    e20.setContractCode(workflow.getContractCode());
                                    break label374;
                                }

                                if("17".equals(workflow.getTypeId())) {
                                    WorkflowDetail17 e19 = new WorkflowDetail17();
                                    workflowDetail = e19;
                                    e19.setContractCode(workflow.getContractCode());
                                    detail = this.getParamInt(request, "payListId");
                                    if(this.chkNullZ(detail)) {
                                        return this.getResult(false, "请选择付款单!");
                                    }

                                    payListId = (PayList)this.payListDao.getById(detail);
                                    if(payListId == null) {
                                        return this.getResult(false, "付款单错误!");
                                    }

                                    e19.setPayListId(payListId.getAutoId());
                                    e19.setOldPayType(payListId.getPayType());
                                    e19.setPayType(this.getParam(request, "payType"));
                                    if(this.chkNull(e19.getPayType())) {
                                        return this.getResult(false, "付款方式错误!");
                                    }
                                    break label374;
                                }

                                if("20".equals(workflow.getTypeId())) {
                                    WorkflowDetail20 e18 = new WorkflowDetail20();
                                    workflowDetail = e18;
                                    e18.setContractCode(workflow.getContractCode());
                                    e18.setPaid(Integer.valueOf(0));
                                    e18.setAdjustAmount(this.getParamDouble(request, "adjustAmount"));
                                    if(this.chkNull(e18.getAdjustAmount())) {
                                        return this.getResult(false, "调整金额错误!");
                                    }
                                    break label374;
                                }

                                if("23".equals(workflow.getTypeId())) {
                                    WorkflowDetail23 e17 = new WorkflowDetail23();
                                    workflowDetail = e17;
                                    e17.setContractCode(workflow.getContractCode());
                                    e17.setOldSalesCode(ccode4.getSalesCode());
                                    e17.setSalesCode(this.getParam(request, "salesCode"));
                                    if(this.chkNull(e17.getSalesCode())) {
                                        return this.getResult(false, "新销售员错误!");
                                    }
                                    break label374;
                                }

                                if("24".equals(workflow.getTypeId())) {
                                    WorkflowDetail24 e16 = new WorkflowDetail24();
                                    workflowDetail = e16;
                                    e16.setContractCode(workflow.getContractCode());
                                    e16.setOldSalesCode(ccode4.getSalesCode2());
                                    e16.setSalesCode(this.getParam(request, "salesCode"));
                                    if(this.chkNull(e16.getSalesCode())) {
                                        return this.getResult(false, "新销售员错误!");
                                    }
                                    break label374;
                                }

                                if("30".equals(workflow.getTypeId())) {
                                    WorkflowDetail30 e15 = new WorkflowDetail30();
                                    workflowDetail = e15;
                                    e15.setContractCode(workflow.getContractCode());
                                    e15.setOldStopFee(ccode4.getStopFee());
                                    e15.setOldChangeFee(ccode4.getChangeFee());
                                    e15.setOldMendFee(ccode4.getMendFee());
                                    e15.setOldChgShopFee(ccode4.getChgShopFee());
                                    e15.setStopFee(this.getParamDouble(request, "stopFee"));
                                    e15.setChangeFee(this.getParamDouble(request, "changeFee"));
                                    e15.setMendFee(this.getParamDouble(request, "mendFee"));
                                    e15.setChgShopFee(this.getParamDouble(request, "chgShopFee"));
                                    if(this.chkNull(e15.getStopFee())) {
                                        return this.getResult(false, "新停卡费错误!");
                                    }

                                    if(this.chkNull(e15.getChangeFee())) {
                                        return this.getResult(false, "新转让费错误!");
                                    }

                                    if(this.chkNull(e15.getMendFee())) {
                                        return this.getResult(false, "新补卡费错误!");
                                    }

                                    if(this.chkNull(e15.getChgShopFee())) {
                                        return this.getResult(false, "新转店费错误!");
                                    }
                                    break label374;
                                }

                                if("31".equals(workflow.getTypeId())) {
                                    WorkflowDetail31 e14 = new WorkflowDetail31();
                                    workflowDetail = e14;
                                    e14.setContractCode(workflow.getContractCode());
                                    e14.setOldCommissionDate(ccode4.getCommissionDate());
                                    e14.setCommissionDate(this.getParamDate(request, "commissionDate"));
                                    if(this.chkNull(e14.getCommissionDate())) {
                                        return this.getResult(false, "新计佣日期错误!");
                                    }
                                    break label374;
                                }

                                if(!"34".equals(workflow.getTypeId())) {
                                    break label374;
                                }

                                WorkflowDetail34 e13 = new WorkflowDetail34();
                                workflowDetail = e13;
                                e13.setContractCode(workflow.getContractCode());
                                String detail2 = this.getParam(request, "giftCardCode");
                                GiftCard payListId2 = this.giftCardDao.getByCardCode(detail2);
                                if(payListId2 != null && payListId2.getShopCode().equalsIgnoreCase(ccode4.getShopCode())) {
                                    if(payListId2.getStatus().intValue() != 1) {
                                        return this.getResult(false, "储值卡号已使用,请选择其他卡号");
                                    }

                                    if(payListId2.getReportLoss().intValue() == 1) {
                                        return this.getResult(false, "储值卡号已挂失,请选择其他卡号");
                                    }

                                    e13.setGiftCardCode(payListId2.getCardCode());
                                    e13.setGiftCardType(payListId2.getCardType());
                                    e13.setGiftCardAmount(payListId2.getCardAmount());
                                    break label374;
                                }

                                return this.getResult(false, "没有这个储值卡号");
                            }

                            return this.getResult(false, "无效合同");
                        }
                    } else if(FuncUtil.strInArray(workflow.getTypeId(), new String[]{"25", "26", "27"})) {
                        if(this.chkNull(workflow.getContractCode())) {
                            return this.getResult(false, "请输入合同号");
                        }
                    } else if(FuncUtil.strInArray(workflow.getTypeId(), new String[]{"02", "05", "06", "07", "15", "16", "18", "19", "21", "22"})) {
                        if(this.chkNull(workflow.getContractCode())) {
                            return this.getResult(false, "请输入私教合同号");
                        }

                        PtContract ccode3 = this.ptContractDao.getByContractCode(workflow.getContractCode());
                        if(ccode3 == null) {
                            return this.getResult(false, "私教合同号错误!");
                        }

                        if(ccode3.getOutTime() != null) {
                            return this.getResult(false, "无效合同");
                        }

                        workflow.setMemberCode(ccode3.getMemberCode());
                        if("02".equals(workflow.getTypeId())) {
                            WorkflowDetail02 e12 = new WorkflowDetail02();
                            workflowDetail = e12;
                            e12.setContractCode(workflow.getContractCode());
                            e12.setOldDate(ccode3.getEndTime());
                            e12.setDeferDate(this.getParamDate(request, "deferDate"));
                            if(this.chkNull(e12.getDeferDate()) || e12.getDeferDate().before(e12.getOldDate())) {
                                return this.getResult(false, "延期日期错误!");
                            }
                        } else if("05".equals(workflow.getTypeId())) {
                            WorkflowDetail05 e11 = new WorkflowDetail05();
                            workflowDetail = e11;
                            e11.setContractCode(workflow.getContractCode());
                            e11.setOldBeginDate(ccode3.getBeginTime());
                            e11.setOldEndDate(ccode3.getEndTime());
                            e11.setBeginDate(this.getParamDate(request, "beginDate"));
                            e11.setEndDate(this.getParamDate(request, "endDate"));
                            if(this.chkNull(e11.getBeginDate()) || this.chkNull(e11.getEndDate())) {
                                return this.getResult(false, "更改日期错误!");
                            }
                        } else if("06".equals(workflow.getTypeId())) {
                            WorkflowDetail06 e10 = new WorkflowDetail06();
                            workflowDetail = e10;
                            e10.setContractCode(workflow.getContractCode());
                            e10.setPtBespeakId(this.getParamInt(request, "bespeakId"));
                            if(this.chkNull(e10.getPtBespeakId())) {
                                return this.getResult(false, "预约号错误!");
                            }
                        } else if("07".equals(workflow.getTypeId())) {
                            WorkflowDetail07 e9 = new WorkflowDetail07();
                            workflowDetail = e9;
                            e9.setContractCode(workflow.getContractCode());
                            e9.setOldQuantity(ccode3.getQuantity());
                            e9.setQuantity(this.getParamInt(request, "quantity"));
                            if(this.chkNull(e9.getQuantity()) || e9.getQuantity().intValue() < 0) {
                                return this.getResult(false, "更改课时数错误!");
                            }
                        } else if("15".equals(workflow.getTypeId())) {
                            WorkflowDetail15 e3 = new WorkflowDetail15();
                            workflowDetail = e3;
                            e3.setContractCode(workflow.getContractCode());
                            e3.setOldQuantity(Integer.valueOf(ccode3.getQuantity().intValue() - ccode3.getBespeakQuantity().intValue()));
                            e3.setQuantity(this.getParamInt(request, "quantity"));
                            e3.setClassTime(this.getParamDate(request, "classTime"));
                            e3.setCoachCode(this.getParam(request, "coachCode"));
                            if(this.chkNullZ(e3.getQuantity())) {
                                return this.getResult(false, "核销课时数错误!");
                            }

                            if(e3.getQuantity().intValue() > e3.getOldQuantity().intValue()) {
                                return this.getResult(false, "核销课时数超过剩余课时数!");
                            }

                            if(this.chkNull(e3.getClassTime())) {
                                return this.getResult(false, "核销日期错误!");
                            }

                            if(this.chkNull(e3.getCoachCode())) {
                                return this.getResult(false, "核销教练错误!");
                            }
                        } else if("16".equals(workflow.getTypeId())) {
                            WorkflowDetail16 e4 = new WorkflowDetail16();
                            workflowDetail = e4;
                            e4.setContractCode(workflow.getContractCode());
                            detail = this.getParamInt(request, "payListId");
                            if(this.chkNullZ(detail)) {
                                return this.getResult(false, "请选择付款单!");
                            }

                            payListId = (PayList)this.payListDao.getById(detail);
                            if(payListId == null) {
                                return this.getResult(false, "付款单错误!");
                            }

                            e4.setPayListId(payListId.getAutoId());
                            e4.setOldPayType(payListId.getPayType());
                            e4.setPayType(this.getParam(request, "payType"));
                            if(this.chkNull(e4.getPayType())) {
                                return this.getResult(false, "付款方式错误!");
                            }
                        } else if("18".equals(workflow.getTypeId())) {
                            WorkflowDetail18 e5 = new WorkflowDetail18();
                            workflowDetail = e5;
                            e5.setContractCode(workflow.getContractCode());
                            e5.setOldSalesCode(ccode3.getSalesCode());
                            e5.setSalesCode(this.getParam(request, "salesCode"));
                            if(this.chkNull(e5.getSalesCode())) {
                                return this.getResult(false, "新销售员错误!");
                            }
                        } else if("19".equals(workflow.getTypeId())) {
                            WorkflowDetail19 e6 = new WorkflowDetail19();
                            workflowDetail = e6;
                            e6.setContractCode(workflow.getContractCode());
                            e6.setOldSalesCode(ccode3.getSalesCode2());
                            e6.setSalesCode(this.getParam(request, "salesCode"));
                            if(this.chkNull(e6.getSalesCode())) {
                                return this.getResult(false, "新销售员错误!");
                            }
                        } else if("21".equals(workflow.getTypeId())) {
                            WorkflowDetail21 e7 = new WorkflowDetail21();
                            workflowDetail = e7;
                            e7.setContractCode(workflow.getContractCode());
                            e7.setOldCommissionDate(ccode3.getCommissionDate());
                            e7.setCommissionDate(this.getParamDate(request, "commissionDate"));
                            if(this.chkNull(e7.getCommissionDate())) {
                                return this.getResult(false, "新计佣日期错误!");
                            }
                        } else if("22".equals(workflow.getTypeId())) {
                            WorkflowDetail22 e8 = new WorkflowDetail22();
                            workflowDetail = e8;
                            e8.setContractCode(workflow.getContractCode());
                            e8.setPaid(Integer.valueOf(0));
                            e8.setAdjustAmount(this.getParamDouble(request, "adjustAmount"));
                            if(this.chkNull(e8.getAdjustAmount())) {
                                return this.getResult(false, "调整金额错误!");
                            }
                        }
                    } else if(FuncUtil.strInArray(workflow.getTypeId(), new String[]{"03", "28"})) {
                        MemberEarnest ccode = (MemberEarnest)this.memberEarnestDao.getById(this.parseInt(workflow.getContractCode()));
                        if(ccode == null) {
                            return this.getResult(false, "定金号错误!");
                        }

                        workflow.setMemberCode(ccode.getMemberCode());
                        if("03".equals(workflow.getTypeId())) {
                            WorkflowDetail03 e = new WorkflowDetail03();
                            workflowDetail = e;
                            e.setEarnestId(this.parseInt(workflow.getContractCode()));
                        } else if("28".equals(workflow.getTypeId())) {
                            WorkflowDetail28 e1 = new WorkflowDetail28();
                            workflowDetail = e1;
                            e1.setEarnestId(this.parseInt(workflow.getContractCode()));
                            detail = this.getParamInt(request, "payListId");
                            if(this.chkNullZ(detail)) {
                                return this.getResult(false, "请选择付款单!");
                            }

                            payListId = (PayList)this.payListDao.getById(detail);
                            if(payListId == null) {
                                return this.getResult(false, "付款单错误!");
                            }

                            e1.setPayListId(payListId.getAutoId());
                            e1.setOldPayType(payListId.getPayType());
                            e1.setPayType(this.getParam(request, "payType"));
                            if(this.chkNull(e1.getPayType())) {
                                return this.getResult(false, "付款方式错误!");
                            }
                        }
                    } else if(!"29".equals(workflow.getTypeId())) {
                        if("32".equals(workflow.getTypeId())) {
                            Integer ccode1 = this.getParamInt(request, "productSaleId");
                            if(this.chkNullZ(ccode1)) {
                                return this.getResult(false, "请输入销售单号!");
                            }

                            PssProductSale e2 = (PssProductSale)this.pssProductSaleDao.getById(ccode1);
                            if(e2 == null) {
                                return this.getResult(false, "销售单号错误");
                            }

                            workflow.setContractCode(String.valueOf(ccode1));
                            workflow.setMemberCode(e2.getMemberCode());
                            WorkflowDetail32 detail1 = new WorkflowDetail32();
                            workflowDetail = detail1;
                            detail1.setProductSaleId(ccode1);
                            Integer payListId1 = this.getParamInt(request, "payListId");
                            if(this.chkNullZ(payListId1)) {
                                return this.getResult(false, "请选择付款单!");
                            }

                            PayList pay = (PayList)this.payListDao.getById(payListId1);
                            if(pay == null) {
                                return this.getResult(false, "付款单错误!");
                            }

                            detail1.setPayListId(pay.getAutoId());
                            detail1.setOldPayType(pay.getPayType());
                            detail1.setPayType(this.getParam(request, "payType"));
                            if(this.chkNull(detail1.getPayType())) {
                                return this.getResult(false, "付款方式错误!");
                            }
                        } else {
                            if(!"33".equals(workflow.getTypeId())) {
                                return this.getResult(false, "目前不能提交该类申请!");
                            }

                            WorkflowDetail33 ccode2 = new WorkflowDetail33();
                            workflowDetail = ccode2;
                            ccode2.setIdType(this.getParam(request, "idType"));
                            ccode2.setIdNumber(this.getParam(request, "idNumber"));
                            ccode2.setChName(this.getParam(request, "chName"));
                            ccode2.setMobile(this.getParam(request, "mobile"));
                            ccode2.setStatus(this.getParamInt(request, "status"));
                        }
                    }
                }

                String ccode6 = "01".equals(workflow.getTypeId())?workflow.getMemberCode():workflow.getContractCode();
                if(this.workflowListDao.chkWorkflowNotProc(workflow.getTypeId(), ccode6, (String[])extProp)) {
                    return this.getResult(false, "存在未处理完成的流程,不能重复提交!");
                } else {
                    workflow.setShopCode(this.getLoginShopCode());
                    workflow.setFileNum(Integer.valueOf(0));
                    workflow.setStatus(Integer.valueOf(0));
                    workflow.setProcResult1(Integer.valueOf(0));
                    workflow.setProcResult2(Integer.valueOf(0));
                    workflow.setProcResult3(Integer.valueOf(0));
                    workflow.setCreateUser(this.getLoginUserCode());
                    workflow.setCreateTime(new Date());
                    workflow.setUpdateTime(new Date());

                    try {
                        this.workflowListDao.addWorkflow(workflow, workflowDetail);
                        this.addUserLog("新增" + workflowType.getChName(), "编号:" + workflow.getWorkflowId() + (!this.chkNull(workflow.getContractCode())?",合同号:" + workflow.getContractCode():",会员号:" + workflow.getMemberCode()));
                    } catch (Exception var11) {
                        this.log.error("add workflow", var11);
                        return this.getResult(false, "保存发生错误");
                    }

                    return this.getResult(true, "保存完成");
                }
            }
        }
    }

    @RequestMapping({"edit"})
    public ModelAndView edit(@RequestParam("id") int id) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow == null) {
            return this.showAlert("没有这个申请!");
        } else {
            ModelAndView mv = new ModelAndView("workflow/apply/edit");
            mv.addObject("workflow", workflow);
            mv.addObject("_oper", "edit");
            return mv;
        }
    }

    @RequestMapping({"_edit"})
    @ResponseBody
    public String _edit(@RequestParam("id") int id, @RequestParam(value = "note",required = false) String note, @RequestParam(value = "submit",required = false) String submit) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow != null && workflow.getCreateUser().equalsIgnoreCase(this.getLoginUserCode())) {
            if(workflow.getStatus().intValue() != 0) {
                return this.getResult(false, "申请已进入审批流程,不能更改!");
            } else {
                try {
                    this.workflowListDao.updateNote(workflow.getWorkflowId().intValue(), note, "1".equals(submit));
                    this.addUserLog(("1".equals(submit)?"提交审核":"修改申请原因") + this.cache.getValue("workflowType", workflow.getTypeId()), "编号:" + workflow.getWorkflowId() + (!this.chkNull(workflow.getContractCode())?",合同号:" + workflow.getContractCode():",会员号:" + workflow.getMemberCode()));
                } catch (Exception var6) {
                    this.log.error("edit workflowtype", var6);
                    return this.getResult(false, "保存发生错误");
                }

                return this.getResult(true, "保存完成");
            }
        } else {
            return this.getResult(false, "没有这个申请!");
        }
    }

    @RequestMapping({"_cancel"})
    @ResponseBody
    public String _cancel(@RequestParam("id") int id) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow != null && workflow.getCreateUser().equalsIgnoreCase(this.getLoginUserCode())) {
            if(workflow.getStatus().intValue() != 0) {
                return this.getResult(false, "申请已进入审批流程,不能撤销!");
            } else {
                try {
                    this.workflowListDao.updateCancel(workflow.getWorkflowId().intValue());
                    this.addUserLog("撤销申请" + this.cache.getValue("workflowType", workflow.getTypeId()), "编号:" + workflow.getWorkflowId() + (!this.chkNull(workflow.getContractCode())?",合同号:" + workflow.getContractCode():",会员号:" + workflow.getMemberCode()));
                } catch (Exception var4) {
                    this.log.error("cancel workflowtype", var4);
                    return this.getResult(false, "保存发生错误");
                }

                return this.getResult(true, "撤销完成");
            }
        } else {
            return this.getResult(false, "没有这个申请!");
        }
    }

    @RequestMapping({"upload"})
    public ModelAndView upload(@RequestParam("id") int id) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow != null && workflow.getCreateUser().equalsIgnoreCase(this.getLoginUserCode())) {
            List flist = this.workflowFileDao.getListByWorkflowId(id);
            ModelAndView mv = new ModelAndView("workflow/apply/upload");
            mv.addObject("workflow", workflow);
            mv.addObject("flist", flist);
            mv.addObject("_picPath", this.getSetting("pic.path"));
            return mv;
        } else {
            return this.showAlert("没有这个申请!");
        }
    }

    @RequestMapping({"_upload"})
    @ResponseBody
    public String _upload(@RequestParam("id") int id, @RequestParam("file") MultipartFile file) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow != null && workflow.getCreateUser().equalsIgnoreCase(this.getLoginUserCode())) {
            if(workflow.getStatus().intValue() != 0) {
                return this.getResult(false, "申请已进入审批流程,不能更改!");
            } else {
                StringBuilder msg = new StringBuilder();
                Upload upload = this.uploadService.upload(file, msg);
                if(upload == null) {
                    return this.getResult(false, msg.toString());
                } else {
                    WorkflowFile workflowFile = new WorkflowFile();
                    workflowFile.setWorkflowId(workflow.getWorkflowId());
                    workflowFile.setFileUrl(upload.getUrl());
                    workflowFile.setCreateUser(this.getLoginUserCode());
                    workflowFile.setCreateTime(new Date());
                    workflowFile.setUpdateTime(new Date());

                    try {
                        this.workflowFileDao.addFile(workflowFile);
                        this.addUserLog("上传附件" + this.cache.getValue("workflowType", workflow.getTypeId()), "编号:" + workflow.getWorkflowId() + (!this.chkNull(workflow.getContractCode())?",合同号:" + workflow.getContractCode():",会员号:" + workflow.getMemberCode()));
                    } catch (Exception var8) {
                        this.log.error("add workflowfile", var8);
                        return this.getResult(false, "保存发生错误");
                    }

                    return this.getSuccess("{\"fid\":" + upload.getFileId() + ",\"furl\":\"" + upload.getUrl() + "\"}", "上传成功");
                }
            }
        } else {
            return this.getResult(false, "没有这个申请!");
        }
    }

    @RequestMapping({"pay"})
    public ModelAndView pay(@RequestParam("id") int id) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow == null) {
            return this.showAlert("没有这个申请!");
        } else if(workflow.getStatus().intValue() != 3 || workflow.getProcResult3().intValue() != 1 && workflow.getProcResult3().intValue() != -1) {
            return this.showAlert("没有完成审批,不能付款!");
        } else {
            double money = 0.0D;
            if("20".equals(workflow.getTypeId())) {
                WorkflowDetail20 detail22 = (WorkflowDetail20)this.workflowListDao.getWorkflowDetail(Integer.valueOf(id), workflow.getTypeId());
                money = detail22.getAdjustAmount().doubleValue();
            } else {
                if(!"22".equals(workflow.getTypeId())) {
                    return this.showAlert("该类申请不能付款!");
                }

                WorkflowDetail22 detail221 = (WorkflowDetail22)this.workflowListDao.getWorkflowDetail(Integer.valueOf(id), workflow.getTypeId());
                money = detail221.getAdjustAmount().doubleValue();
            }

            return (new ModelAndView("member/pay")).addObject("money", Double.valueOf(money)).addObject("payType", this.payTypeCodeDao.getValidList());
        }
    }

    @RequestMapping({"_pay"})
    @ResponseBody
    public String _pay(@RequestParam("id") int id, @RequestParam("payls") String payls) {
        WorkflowList workflow = (WorkflowList)this.workflowListDao.getById(Integer.valueOf(id));
        if(workflow == null) {
            return this.getResult(false, "没有这个申请!");
        } else if(workflow.getStatus().intValue() == 3 && (workflow.getProcResult3().intValue() == 1 || workflow.getProcResult3().intValue() == -1)) {
            if("20".equals(workflow.getTypeId())) {
                WorkflowDetail20 detail221 = (WorkflowDetail20)this.workflowListDao.getWorkflowDetail(Integer.valueOf(id), workflow.getTypeId());
                return detail221.getPaid().intValue() != 0?this.getResult(false, "已经付款!"):this.paymb(detail221, payls);
            } else if("22".equals(workflow.getTypeId())) {
                WorkflowDetail22 detail22 = (WorkflowDetail22)this.workflowListDao.getWorkflowDetail(Integer.valueOf(id), workflow.getTypeId());
                return detail22.getPaid().intValue() != 0?this.getResult(false, "已经付款!"):this.paypt(detail22, payls);
            } else {
                return this.getResult(false, "该类申请不能付款!");
            }
        } else {
            return this.getResult(false, "没有完成审批,不能付款!");
        }
    }

    private String paymb(WorkflowDetail20 detail, String payls) {
        MemberContract oldContract = this.memberContractDao.getByContractCode(detail.getContractCode());
        if(oldContract == null) {
            return this.getResult(false, "合同号错误");
        } else {
            ArrayList payList = new ArrayList();
            PayList pay = this.getPayList(payls, payList, "01");
            if(!this.equals(pay.getAmount().doubleValue(), detail.getAdjustAmount().doubleValue())) {
                return this.getResult(false, "付款金额不一致");
            } else {
                Date date = this.getTrimDate(new Date());
                MemberContract contract = new MemberContract();
                contract.setShopCode(oldContract.getShopCode());
                contract.setMemberCode(oldContract.getMemberCode());
                contract.setCardCode(oldContract.getCardCode());
                contract.setSaleType("8");
                contract.setPromotionId((Integer)null);
                contract.setEarnestId((Integer)null);
                contract.setEarnestAmount(Double.valueOf(0.0D));
                contract.setSaleDate(new Date());
                contract.setBeginTime(date);
                contract.setEndTime(date);
                contract.setNewEndTime((Date)null);
                contract.setTotalCount(Integer.valueOf(0));
                contract.setRestCount(Integer.valueOf(0));
                contract.setCardType(oldContract.getCardType());
                contract.setManyShop(oldContract.getManyShop());
                contract.setValids(oldContract.getValids());
                contract.setValidUnit(oldContract.getValidUnit());
                contract.setAddValids(oldContract.getAddValids());
                contract.setAddValidUnit(oldContract.getAddValidUnit());
                contract.setAddFee(oldContract.getAddFee());
                contract.setFixedFee(oldContract.getFixedFee());
                contract.setStopFee(oldContract.getStopFee());
                contract.setChangeFee(oldContract.getChangeFee());
                contract.setMendFee(oldContract.getMendFee());
                contract.setChgShopFee(oldContract.getChgShopFee());
                contract.setContDiscount(oldContract.getContDiscount());
                contract.setCardPrice(detail.getAdjustAmount());
                contract.setTotalPrice(detail.getAdjustAmount());
                contract.setFactPrice(detail.getAdjustAmount());
                contract.setPayAmount(detail.getAdjustAmount());
                contract.setInAmount(Double.valueOf(0.0D));
                contract.setStatus(Integer.valueOf(1));
                contract.setNote("会籍金额调整合同,原合同：" + oldContract.getContractCode());
                contract.setOldContractCode(oldContract.getContractCode());
                contract.setCommissionDate(new Date());
                contract.setReceivePaper(Integer.valueOf(0));
                contract.setBarcodeTasteContract(Integer.valueOf(0));
                contract.setSignStatus(Integer.valueOf(0));
                contract.setPrintLabel(Integer.valueOf(0));
                contract.setSalesCode(pay.getSalesCode());
                contract.setSalesCode2(pay.getSalesCode2());
                contract.setCreateUser(this.getLoginUserCode());
                contract.setCreateTime(new Date());
                contract.setUpdateTime(new Date());
                contract.setReviewStatus(Integer.valueOf(0));

                try {
                    this.workflowListDao.addMemberContractAdjust(detail, payList, contract);
                    this.addUserLog("会籍合同补款付款", "申请编号:" + detail.getWorkflowId() + ",合同号:" + detail.getContractCode());
                } catch (Exception var9) {
                    this.log.error("pay membercontract adjust", var9);
                    return this.getResult(false, "保存发生错误");
                }

                return this.getSuccess(String.valueOf(detail.getWorkflowId()), "保存完成");
            }
        }
    }

    private String paypt(WorkflowDetail22 detail, String payls) {
        PtContract oldContract = this.ptContractDao.getByContractCode(detail.getContractCode());
        if(oldContract == null) {
            return this.getResult(false, "私教合同号错误!");
        } else {
            ArrayList payList = new ArrayList();
            PayList pay = this.getPayList(payls, payList, "02");
            if(!this.equals(pay.getAmount().doubleValue(), detail.getAdjustAmount().doubleValue())) {
                return this.getResult(false, "付款金额不一致");
            } else {
                Date date = this.getTrimDate(new Date());
                PtContract contract = new PtContract();
                contract.setContractCode(oldContract.getContractCode());
                contract.setShopCode(oldContract.getShopCode());
                contract.setMemberCode(oldContract.getMemberCode());
                contract.setPtCode(oldContract.getPtCode());
                contract.setCoachCode(oldContract.getCoachCode());
                contract.setEarnestId((Integer)null);
                contract.setEarnestAmount(Double.valueOf(0.0D));
                contract.setInAmount(Double.valueOf(0.0D));
                contract.setFactPrice(detail.getAdjustAmount());
                contract.setPayAmount(detail.getAdjustAmount());
                contract.setSaleType("5");
                contract.setSaleDate(new Date());
                contract.setQuantity(Integer.valueOf(0));
                contract.setBespeakQuantity(Integer.valueOf(0));
                contract.setClearQuantity(Integer.valueOf(0));
                contract.setBeginTime(date);
                contract.setEndTime(date);
                contract.setStatus(Integer.valueOf(1));
                contract.setNote("私教调整合同,原合同：" + oldContract.getContractCode());
                contract.setOldContractCode(oldContract.getContractCode());
                contract.setCommissionDate(new Date());
                contract.setReceivePaper(Integer.valueOf(0));
                contract.setSignStatus(Integer.valueOf(0));
                contract.setPrintLabel(Integer.valueOf(0));
                String saleClassify = "2";
                Integer pn = this.ptContractDao.getCountByMemberCode(contract.getMemberCode());
                if(!this.chkNullZ(pn)) {
                    saleClassify = "1";
                }

                Date dt = this.memberContractDao.getFirstDateByMemberCode(contract.getMemberCode());
                if(this.getAccountDate(new Date()).equals(this.getAccountDate(dt))) {
                    saleClassify = "3";
                }

                contract.setSaleClassify(saleClassify);
                contract.setCreateUser(this.getLoginUserCode());
                contract.setCreateTime(new Date());
                contract.setUpdateTime(new Date());
                contract.setReviewStatus(Integer.valueOf(0));
                contract.setSalesCode(pay.getSalesCode());
                contract.setSalesCode2(pay.getSalesCode2());

                try {
                    this.workflowListDao.addPtContractAdjust(detail, payList, contract);
                    this.addUserLog("私教合同补款付款", "申请编号:" + detail.getWorkflowId() + ",合同号:" + detail.getContractCode());
                } catch (Exception var12) {
                    this.log.error("pay ptcontract adjust", var12);
                    return this.getResult(false, "保存发生错误");
                }

                return this.getSuccess(String.valueOf(detail.getWorkflowId()), "保存完成");
            }
        }
    }

    @RequestMapping({"getMember"})
    @ResponseBody
    public String getMember(@RequestParam("code") String code) {
        MemberInfo member = this.memberInfoDao.getById(code);
        if(member == null) {
            return this.getResult(false, "会员编号错误");
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            StringBuilder sb = new StringBuilder();
            sb.append("{memberCode:\"").append(member.getMemberCode()).append("\"").append(",cardCode:\"").append(member.getCardCode()).append("\"").append(",shopCode:\"").append(member.getShopCode()).append("\"").append(",memberName:\"").append(member.getChName()).append("\"").append(",enName:\"").append(this.convStr(member.getEnName())).append("\"").append(",gender:\"").append(member.getGender()).append("\"").append(",idType:\"").append(this.convStr(member.getIdType())).append("\"").append(",idNumber:\"").append(this.convStr(member.getIdNumber())).append("\"").append(",mobile:\"").append(this.convStr(member.getMobile())).append("\"").append(",phone:\"").append(this.convStr(member.getPhone())).append("\"").append(",birthday:\"").append(member.getBirthday() == null?"":sdf.format(member.getBirthday())).append("\"").append(",country:\"").append(this.convStr(member.getCountry())).append("\"").append(",email:\"").append(this.convStr(member.getEmail())).append("\"").append(",address:\"").append(this.convStr(member.getAddress())).append("\"").append(",note:\"").append(this.convStr(member.getNote())).append("\"").append(",memberPhoto:\"").append(this.nvl(member.getMemberPhoto())).append("\"").append(",idCardPhoto:\"").append(this.nvl(member.getIdCardPhoto())).append("\"").append("}");
            return this.getSuccess(sb.toString(), "");
        }
    }

    @RequestMapping({"getContract"})
    @ResponseBody
    public String getContract(@RequestParam("code") String code) {
        MemberContract contract = this.memberContractDao.getByContractCode(code);
        if(contract == null) {
            return this.getResult(false, "合同号错误");
        } else {
            Date beginTime = contract.getBeginTime();
            Date endTime = contract.getEndTime();
            if(beginTime != null && endTime != null && contract.getEffectiveDate() == null && !"8".equals(contract.getSaleType())) {
                double leftAmount;
                if(contract.getEndTime().getTime() < System.currentTimeMillis()) {
                    leftAmount = 0.0D;
                } else if(contract.getTotalCount().intValue() > 0) {
                    leftAmount = (double)Math.round((double)contract.getRestCount().intValue() * contract.getFactPrice().doubleValue() / (double)contract.getTotalCount().intValue());
                } else if(beginTime.getTime() > System.currentTimeMillis()) {
                    leftAmount = contract.getFactPrice().doubleValue();
                } else {
                    leftAmount = (double)Math.round((double)(endTime.getTime() - System.currentTimeMillis()) * contract.getFactPrice().doubleValue() / (double)(endTime.getTime() - beginTime.getTime()));
                }

                if(leftAmount > contract.getFactPrice().doubleValue()) {
                    leftAmount = contract.getFactPrice().doubleValue();
                }

                if(leftAmount < 0.0D) {
                    leftAmount = 0.0D;
                }

                MemberInfo member = this.memberInfoDao.getById(contract.getMemberCode());
                if(member == null) {
                    return this.getResult(false, "会员信息错误");
                } else {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                    StringBuilder sb = new StringBuilder();
                    sb.append("{contractCode:\"").append(contract.getContractCode()).append("\"").append(",saleId:\"").append(contract.getSaleId()).append("\"").append(",shopCode:\"").append(contract.getShopCode()).append("\"").append(",shopName:\"").append(this.cache.getValue("shopName", contract.getShopCode())).append("\"").append(",saleDate:").append(contract.getSaleDate().getTime()).append("").append(",saleType:\"").append(contract.getSaleType()).append("\"").append(",saleTypeName:\"").append(this.cache.getValue("memberSaleType", contract.getSaleType())).append("\"").append(",beginTime:").append(beginTime.getTime()).append("").append(",endTime:").append(endTime.getTime()).append("").append(",newEndTime:\"").append(contract.getNewEndTime() == null?"":sdf.format(contract.getNewEndTime())).append("\"").append(",commissionDate:\"").append(contract.getCommissionDate() == null?"":sdf.format(contract.getCommissionDate())).append("\"").append(",factPrice:").append(contract.getFactPrice()).append("").append(",earnestAmount:").append(contract.getEarnestAmount()).append("").append(",inAmount:").append(contract.getInAmount()).append("").append(",payAmount:").append(contract.getPayAmount()).append("").append(",leftAmount:").append(leftAmount).append("").append(",totalCount:").append(contract.getTotalCount()).append("").append(",restCount:").append(contract.getRestCount()).append("").append(",cardType:\"").append(contract.getCardType()).append("\"").append(",cardTypeName:\"").append(this.cache.getValue("cardType", contract.getCardType())).append("\"").append(",manyShop:\"").append(contract.getManyShop()).append("\"").append(",manyShopName:\"").append(this.nvl(this.cache.getValue("cardArea", contract.getManyShop()))).append("\"").append(",stopFee:").append(contract.getStopFee()).append("").append(",chgShopFee:").append(contract.getChgShopFee()).append("").append(",mendFee:").append(contract.getMendFee()).append("").append(",changeFee:").append(contract.getChangeFee()).append("").append(",cardCode:\"").append(member.getCardCode()).append("\"").append(",memberCode:\"").append(member.getMemberCode()).append("\"").append(",memberName:\"").append(member.getChName()).append("\"").append(",salesCode:\"").append(this.nvl(contract.getSalesCode())).append("\"").append(",salesName:\"").append(this.nvl(this.cache.getValue("salesName", contract.getSalesCode()))).append("\"").append(",salesCode2:\"").append(this.nvl(contract.getSalesCode2())).append("\"").append(",salesName2:\"").append(this.nvl(this.cache.getValue("salesName", contract.getSalesCode2()))).append("\"").append(",giftCardCode:\"").append(this.nvl(contract.getGiftCardCode())).append("\"").append("}");
                    return this.getSuccess(sb.toString(), "");
                }
            } else {
                return this.getResult(false, "无效合同");
            }
        }
    }

    @RequestMapping({"getPtContract"})
    @ResponseBody
    public String getPtContract(@RequestParam("code") String code) {
        PtContract contract = this.ptContractDao.getByContractCode(code);
        if(contract == null) {
            return this.getResult(false, "合同号错误");
        } else {
            Date beginTime = contract.getBeginTime();
            Date endTime = contract.getEndTime();
            if(contract.getOutTime() != null) {
                return this.getResult(false, "无效合同");
            } else {
                MemberInfo member = this.memberInfoDao.getById(contract.getMemberCode());
                if(member == null) {
                    return this.getResult(false, "会员信息错误");
                } else {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                    StringBuilder sb = new StringBuilder();
                    sb.append("{contractCode:\"").append(contract.getContractCode()).append("\"").append(",saleId:\"").append(contract.getSaleId()).append("\"").append(",shopCode:\"").append(contract.getShopCode()).append("\"").append(",shopName:\"").append(this.cache.getValue("shopName", contract.getShopCode())).append("\"").append(",saleDate:").append(contract.getSaleDate().getTime()).append("").append(",saleType:\"").append(contract.getSaleType()).append("\"").append(",saleTypeName:\"").append(this.cache.getValue("ptSaleType", contract.getSaleType())).append("\"").append(",beginTime:").append(beginTime.getTime()).append("").append(",endTime:").append(endTime.getTime()).append("").append(",commissionDate:\"").append(contract.getCommissionDate() == null?"":sdf.format(contract.getCommissionDate())).append("\"").append(",factPrice:").append(contract.getFactPrice()).append("").append(",earnestAmount:").append(contract.getEarnestAmount()).append("").append(",payAmount:").append(contract.getPayAmount()).append("").append(",quantity:").append(contract.getQuantity()).append("").append(",bespeakQuantity:").append(contract.getBespeakQuantity()).append("").append(",clearQuantity:").append(contract.getClearQuantity()).append("").append(",leftQuantity:").append(contract.getQuantity().intValue() - contract.getClearQuantity().intValue()).append("").append(",ptCode:\"").append(contract.getPtCode()).append("\"").append(",ptCodeName:\"").append(this.cache.getValue("ptItemName", contract.getPtCode())).append("\"").append(",coachCode:\"").append(contract.getCoachCode()).append("\"").append(",coachName:\"").append(this.cache.getValue("ptCoachName", contract.getCoachCode())).append("\"").append(",cardCode:\"").append(member.getCardCode()).append("\"").append(",memberCode:\"").append(member.getMemberCode()).append("\"").append(",memberName:\"").append(member.getChName()).append("\"").append(",salesCode:\"").append(this.nvl(contract.getSalesCode())).append("\"").append(",salesName:\"").append(this.nvl(this.cache.getValue("salesName", contract.getSalesCode()))).append("\"").append(",salesCode2:\"").append(this.nvl(contract.getSalesCode2())).append("\"").append(",salesName2:\"").append(this.nvl(this.cache.getValue("salesName", contract.getSalesCode2()))).append("\"").append("}");
                    return this.getSuccess(sb.toString(), "");
                }
            }
        }
    }

    @RequestMapping({"getPtBespeak"})
    @ResponseBody
    public String getPtBespeak(@RequestParam("bespeakId") int bespeakId) {
        PtBespeak bespeak = (PtBespeak)this.ptBespeakDao.getById(Integer.valueOf(bespeakId));
        if(bespeak == null) {
            return this.getResult(false, "预约号错误");
        } else if(bespeak.getStatus().intValue() == 0) {
            return this.getResult(false, "预约已取消");
        } else {
            PtContract contract = this.ptContractDao.getByContractCode(bespeak.getContractCode());
            if(contract == null) {
                return this.getResult(false, "合同号错误");
            } else {
                Date beginTime = contract.getBeginTime();
                Date endTime = contract.getEndTime();
                if(contract.getOutTime() != null) {
                    return this.getResult(false, "无效合同");
                } else {
                    MemberInfo member = this.memberInfoDao.getById(contract.getMemberCode());
                    if(member == null) {
                        return this.getResult(false, "会员信息错误");
                    } else {
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                        StringBuilder sb = new StringBuilder();
                        sb.append("{contractCode:\"").append(contract.getContractCode()).append("\"").append(",saleId:\"").append(contract.getSaleId()).append("\"").append(",shopCode:\"").append(contract.getShopCode()).append("\"").append(",shopName:\"").append(this.cache.getValue("shopName", contract.getShopCode())).append("\"").append(",saleDate:").append(contract.getSaleDate().getTime()).append("").append(",saleType:\"").append(contract.getSaleType()).append("\"").append(",saleTypeName:\"").append(this.cache.getValue("ptSaleType", contract.getSaleType())).append("\"").append(",beginTime:").append(beginTime.getTime()).append("").append(",endTime:").append(endTime.getTime()).append("").append(",commissionDate:\"").append(contract.getCommissionDate() == null?"":sdf.format(contract.getCommissionDate())).append("\"").append(",factPrice:").append(contract.getFactPrice()).append("").append(",earnestAmount:").append(contract.getEarnestAmount()).append("").append(",payAmount:").append(contract.getPayAmount()).append("").append(",quantity:").append(contract.getQuantity()).append("").append(",bespeakQuantity:").append(contract.getBespeakQuantity()).append("").append(",clearQuantity:").append(contract.getClearQuantity()).append("").append(",leftQuantity:").append(contract.getQuantity().intValue() - contract.getClearQuantity().intValue()).append("").append(",ptCode:\"").append(contract.getPtCode()).append("\"").append(",ptCodeName:\"").append(this.cache.getValue("ptItemName", contract.getPtCode())).append("\"").append(",coachCode:\"").append(bespeak.getCoachCode()).append("\"").append(",coachName:\"").append(this.cache.getValue("ptCoachName", bespeak.getCoachCode())).append("\"").append(",cardCode:\"").append(member.getCardCode()).append("\"").append(",memberCode:\"").append(member.getMemberCode()).append("\"").append(",memberName:\"").append(member.getChName()).append("\"").append(",salesCode:\"").append(this.nvl(contract.getSalesCode())).append("\"").append(",salesName:\"").append(this.nvl(this.cache.getValue("salesName", contract.getSalesCode()))).append("\"").append(",salesCode2:\"").append(this.nvl(contract.getSalesCode2())).append("\"").append(",salesName2:\"").append(this.nvl(this.cache.getValue("salesName", contract.getSalesCode2()))).append("\"").append(",bespeakId:\"").append(bespeak.getAutoId()).append("\"").append(",bespeakDate:\"").append(sdf2.format(bespeak.getBespeakDate())).append("\"").append(",classTime:\"").append(sdf2.format(bespeak.getClassTime())).append("\"").append(",clearTime:\"").append(bespeak.getClearTime() == null?"":sdf2.format(bespeak.getClearTime())).append("\"").append(",printLabel:\"").append(bespeak.getPrintLabel()).append("\"").append("}");
                        return this.getSuccess(sb.toString(), "");
                    }
                }
            }
        }
    }

    @RequestMapping({"getEarnest"})
    @ResponseBody
    public String getEarnest(@RequestParam("saleId") int saleId) {
        MemberEarnest earnest = (MemberEarnest)this.memberEarnestDao.getById(Integer.valueOf(saleId));
        if(earnest == null) {
            return this.getResult(false, "合同号错误");
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            StringBuilder sb = new StringBuilder();
            sb.append("{saleId:\"").append(earnest.getSaleId()).append("\"").append(",shopCode:\"").append(earnest.getShopCode()).append("\"").append(",shopName:\"").append(this.cache.getValue("shopName", earnest.getShopCode())).append("\"").append(",saleDate:").append(earnest.getSaleDate().getTime()).append("").append(",overDueDate:\"").append(sdf.format(earnest.getOverDueDate())).append("\"").append(",earnestType:\"").append(earnest.getEarnestType()).append("\"").append(",earnestTypeName:\"").append(this.cache.getValue("earnestType", earnest.getEarnestType())).append("\"").append(",earnestAmount:").append(earnest.getEarnestAmount()).append("").append(",payAmount:").append(earnest.getPayAmount()).append("").append(",cardCode:\"").append(this.nvl(earnest.getCardCode())).append("\"").append(",memberCode:\"").append(this.nvl(earnest.getMemberCode())).append("\"").append(",memberName:\"").append(earnest.getCustName()).append("\"").append(",salesCode:\"").append(earnest.getSalesCode()).append("\"").append(",salesName:\"").append(this.nvl(this.cache.getValue("salesName", earnest.getSalesCode()))).append("\"").append(",salesCode2:\"").append(earnest.getSalesCode2()).append("\"").append(",salesName2:\"").append(this.nvl(this.cache.getValue("salesName", earnest.getSalesCode2()))).append("\"").append("}");
            return this.getSuccess(sb.toString(), "");
        }
    }

    @RequestMapping({"getProductSale"})
    @ResponseBody
    public String getProductSale(@RequestParam("saleId") int saleId) {
        PssProductSale sale = (PssProductSale)this.pssProductSaleDao.getById(Integer.valueOf(saleId));
        if(sale == null) {
            return this.getResult(false, "销售单号错误");
        } else {
            StringBuilder sb = new StringBuilder();
            sb.append("{saleId:\"").append(sale.getAutoId()).append("\"").append(",shopCode:\"").append(sale.getShopCode()).append("\"").append(",shopName:\"").append(this.cache.getValue("shopName", sale.getShopCode())).append("\"").append(",saleDate:").append(sale.getSaleDate().getTime()).append("").append(",earnestAmount:").append(sale.getEarnestAmount()).append("").append(",saleAmount:").append(sale.getSaleAmount()).append("").append(",cardCode:\"").append(this.nvl(sale.getCardCode())).append("\"").append(",memberCode:\"").append(this.nvl(sale.getMemberCode())).append("\"").append(",salesCode:\"").append(sale.getSaleCode()).append("\"").append(",salesName:\"").append(this.nvl(this.cache.getValue("salesName", sale.getSaleCode()))).append("\"").append("}");
            return this.getSuccess(sb.toString(), "");
        }
    }

    @RequestMapping({"getPayList"})
    @ResponseBody
    public String getPayList(@RequestParam("saleId") Integer saleId, @RequestParam("saleType") String saleType) {
        List list = this.payListDao.getListBySaleId(saleId.intValue(), saleType);
        StringBuilder sb = new StringBuilder();
        sb.append("[");

        PayList pay;
        for(Iterator i$ = list.iterator(); i$.hasNext(); sb.append("{id:\"").append(pay.getAutoId()).append("\"").append(",payType:\"").append(pay.getPayType()).append("\"").append(",payTypeName:\"").append(this.cache.getValue("payType", pay.getPayType())).append("\"").append(",amount:").append(pay.getAmount()).append("").append("}")) {
            pay = (PayList)i$.next();
            if(sb.length() > 5) {
                sb.append(",");
            }
        }

        sb.append("]");
        return this.getSuccess(sb.toString(), "");
    }

    @RequestMapping({"getCardTypeList"})
    @ResponseBody
    public String getCardTypeList(@RequestParam("saleType") Integer saleType) {
        List list = this.cardTypeCodeDao.getShopCardTypeList(this.getLoginShopCode(), saleType.intValue(), 0);
        StringBuilder sb = new StringBuilder();
        sb.append("[");

        CardTypeCode cardType;
        for(Iterator i$ = list.iterator(); i$.hasNext(); sb.append("{code:\"").append(cardType.getCode()).append("\"").append(",name:\"").append(cardType.getChName()).append("\"").append("}")) {
            cardType = (CardTypeCode)i$.next();
            if(sb.length() > 5) {
                sb.append(",");
            }
        }

        sb.append("]");
        return this.getSuccess(sb.toString(), "");
    }

    @RequestMapping({"getSales"})
    @ResponseBody
    public String getSales(@RequestParam("code") String code) {
        DicSalesCode sales = this.dicSalesCodeDao.getById(code);
        if(sales == null) {
            return this.getResult(false, "销售员编号错误");
        } else {
            StringBuilder sb = new StringBuilder();
            sb.append("{code:\"").append(sales.getCode()).append("\"").append(",name:\"").append(sales.getChName()).append("\"").append("}");
            return this.getSuccess(sb.toString(), "");
        }
    }

    @RequestMapping({"getGiftCardList"})
    public ModelAndView getGiftCardList(@RequestParam String shopCode) {
        List list = this.giftCardDao.getNotReceiveList(shopCode);
        List lstp = this.giftCardDao.getNotReceiveTypeCount(shopCode);
        return (new ModelAndView("member/giftcard")).addObject("list", list).addObject("lstp", lstp);
    }

    @RequestMapping({"getGiftCardNew"})
    @ResponseBody
    public String getGiftCardNew(@RequestParam("cardCode") String cardCode, @RequestParam String shopCode) {
        GiftCard card = this.giftCardDao.getByCardCode(cardCode);
        if(card != null && card.getShopCode().equalsIgnoreCase(shopCode)) {
            if(card.getStatus().intValue() != 1) {
                return this.getResult(false, "卡号已使用,请选择其他卡号");
            } else if(card.getReportLoss().intValue() == 1) {
                return this.getResult(false, "卡号已挂失,请选择其他卡号");
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append("{cardCode:\"").append(card.getCardCode()).append("\"").append(",cardType:\"").append(this.nvl(card.getCardType())).append("\"").append(",cardTypeName:\"").append(this.nvl(this.cache.getValue("giftCardType", card.getCardType()))).append("\"").append(",cardAmount:").append(card.getCardAmount()).append("").append("}");
                return this.getSuccess(sb.toString(), "");
            }
        } else {
            return this.getResult(false, "没有这个卡号");
        }
    }

    protected String getParam(HttpServletRequest request, String name) {
        return request.getParameter(name);
    }

    protected Integer getParamInt(HttpServletRequest request, String name) {
        return this.parseInt(request.getParameter(name));
    }

    protected Double getParamDouble(HttpServletRequest request, String name) {
        return this.parseDouble(request.getParameter(name));
    }

    protected Date getParamDate(HttpServletRequest request, String name) {
        return this.parseDate(request.getParameter(name), "yyyy-MM-dd");
    }

    protected PayList getPayList(String payls, List<PayList> payList, String saleType) {
        double money = 0.0D;
        String sales1 = null;
        String sales2 = null;
        String[] ss = payls.split("\\|");
        String[] s1 = ss[0].split(",");
        sales1 = s1[0];
        if(s1.length > 1) {
            sales2 = s1[1];
        }

        if(sales1 == null) {
            sales1 = "";
        }

        if(sales2 == null) {
            sales2 = "";
        }

        for(int pay = 1; pay < ss.length; ++pay) {
            s1 = ss[pay].split(",");
            PayList pay1 = new PayList();
            pay1.setPayType(s1[0]);
            pay1.setAmount(Double.valueOf(Double.parseDouble(s1[1])));
            if(s1.length > 2) {
                pay1.setNote(s1[2]);
            }

            pay1.setSalesCode(sales1);
            pay1.setSalesCode2(sales2);
            pay1.setCashier(this.getLoginUserCode());
            pay1.setShopCode(this.getLoginShopCode());
            pay1.setSaleType(saleType);
            pay1.setSaleDate(new Date());
            pay1.setCreateUser(this.getLoginUserCode());
            pay1.setCreateTime(new Date());
            pay1.setUpdateTime(new Date());
            money += pay1.getAmount().doubleValue();
            payList.add(pay1);
        }

        PayList var12 = new PayList();
        var12.setAmount(Double.valueOf(money));
        var12.setSalesCode(sales1);
        var12.setSalesCode2(sales2);
        return var12;
    }
}
